import { message } from 'antd';

// 复制
// ref: https://stackoverflow.com/a/46118025
const CopyConfig = (text: string) => {
  var dummy = document.createElement('input');
  document.body.appendChild(dummy);
  dummy.setAttribute('value', text);
  dummy.select();
  const result = document.execCommand('copy');
  document.body.removeChild(dummy);
  if (result) {
    message.success('复制成功');
  }
}


// 过滤头部
const filterHeader = (pathname: string) => {
  return ['/login', '/register'].includes(pathname);
}

export {
  CopyConfig,
  filterHeader
}